<template>
    <div class="login">
        <router-link class="login-btn" to="/home">跳转主页</router-link>
      <div class="myTable">
        <el-form ref="form" class="form" :model="form" size="small" label-width="80px" >
          <el-divider content-position="left">基础信息</el-divider>
          <el-row>
            <el-col :span="12">
              <el-form-item label="账号" >
                <el-input v-model="form.username" ></el-input>
              </el-form-item>
              <el-form-item label="密码" >
                <el-input v-model.number="form.password" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item>
            <el-button type="primary" @click="dologin">登录</el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="after">登录之后</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
</template>

<script>
// import http from "core/network/modules/commonReq";
import store from "@/store";
export default {
  data(){
    return{
      form:{
        username:"",
        password:"",
      }
    }
  },
  name: "index",
  methods: {

    async dologin () {
      let param =  this.form
      this.$http.fetchLogin(param).then(res=>{
        store.state.user.token = res.Data
        console.log(store)
      }).catch(err=>{

      })

    },
    after(){
      this.$http.baiduMoyu().then(res=>{
        console.log(res)
      }).catch(err=>{
        console.error(err)
      })
    }
  },

}
</script>

<style scoped lang="less">
/*@import "./index";*/
</style>